package cn.arnold.offer.shence;

import java.util.*;

/**
 * @Author Arnold
 * @Desc TODO
 **/
public class Main {
    static List<String> res = new LinkedList<>();
    static char[] c;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        c = s.toCharArray();
        dfs(0);
        List<String> ans = new ArrayList<>();
        Iterator<String> it = res.iterator();
        while (it.hasNext()) {
            String next = it.next();
            ans.add("'" + next + "'");
        }

        System.out.println(Arrays.toString(ans.toArray()));
    }

    public static void dfs(int x) {
        if (x == c.length - 1) {
            res.add(String.valueOf(c));
            return;
        }
        Set<Character> set = new HashSet<>();
        for (int i = x; i < c.length; i++) {
            if (set.contains(c[i])) continue;
            set.add(c[i]);
            swap(i, x);
            dfs(x + 1);
            swap(i, x);
        }
    }

    public static void swap(int a, int b) {
        char tmp = c[a];
        c[a] = c[b];
        c[b] = tmp;
    }
}
